﻿@model QuickURLShortner.Common.Models.UrlModel

@{
    ViewBag.Title = "Short URL";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div id="wrapper">

<div id="top">
<p><span style="font-size:18px;">Quick Url Shortner</span><span style="font-size:10px;">v1.0 (stable)</span></p>
</div>

<div id="container">
@using (Html.BeginForm("UrlShortner", "Home"))
{ 
       <link href="@Url.Content("~/Content/UrlShortner.css")" rel="stylesheet" type="text/css" />
        <div class="QueryBox">                        
            <div class="editor-label">
            <table width="400px">            
            <tr>
            <td>@Html.LabelFor(m => m.OrignalUrl) :</td>
            <td>@Html.TextBoxFor(m => m.OrignalUrl) *</td>
            <td><input type="submit" value="Create URL" class="newbutton"/></td>
            </tr>

            <tr>
                <td>&nbsp;</td>
                <td>@*@Html.ValidationMessageFor(m => m.OrignalUrl)*@<span class="error" >@Html.ValidationSummary(true, "Please enter a url first !")</span> </td>
                <td>&nbsp;</td>
            </tr>
            </table>
            </div>  
    </div>
    
    <div>       
        @if (ViewData["UrlPart1"] != null && ViewData["UrlPart2"] != null)
        {            
            <p>        
            <span  style="color:Black">Your new shortened URL is : </span>        
            <span style="font-weight:bold; font-size:larger;background-color:Yellow">@Html.ActionLink(ViewData["UrlPart1"].ToString() + ViewData["UrlPart2"].ToString(), "Index", new { query = ViewData["UrlPart2"].ToString() }, new { target = "_blank" })</span>
            <input type="hidden" id="CopyURL"  value="@ViewBag.UrlPart1@ViewBag.UrlPart2" />
            <input type="button" class="newbutton" onclick="javascript:copyToClipboard(CopyURL.value);" value="Copy URL to Clipboard" style="width:auto"/>
            </p>
        }
    </div>
    
}
</div>
</div>